package com.example.ncov_management_system.config;

import com.example.ncov_management_system.interceptor.WebInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/clbum/to_add").setViewName("clbum_add");
        registry.addViewController("/to_password").setViewName("password_reset");
        registry.addViewController("/student_line").setViewName("student_temperature_line");
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new WebInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns("/toLogin","/login", "/static/**");
    }
}
